#ifndef _DSWAVFWDSESSION_H
#define _DSWAVFWDSESSION_H
#include <libdswsession/dswavsession.h>

class CDswavfwdsession : public CDswavsession
{
public:
	CDswavfwdsession(LPST_ENV_T pEnv, char* pHost, int nPort, LPST_TRANS_REQ_T pFwdInfo);
	virtual ~CDswavfwdsession();
public:
	void AddNewTransOrder(char* pP2PPucId);
protected:
	virtual bool ProcessTxtMsg_V1(char* pMsg, int nLen, struct evbuffer *outbuf);
	virtual void OnConnect(struct bufferevent *bev, short events);
public:
	static bool cbPUAStartStreamResp(char* pCId, void* pMsgReq, const char* pMsgResp, void* pCaller){return ((CDswavfwdsession*)pCaller)->PUAStartStreamResp(pCId, pMsgReq, pMsgResp);};
	static bool cbPUGStopStreamResp(char* pCId, void* pMsgReq, const char* pMsgResp, void* pCaller){return ((CDswavfwdsession*)pCaller)->PUGStopStreamResp(pCId, pMsgReq, pMsgResp);};
protected:
	bool PUAStartStreamResp(char* pCId, void* pMsgReq, const char* pMsgResp);
	bool PUGStopStreamResp(char* pCId, void* pMsgReq, const char* pMsgResp);
private:
	void MakePUAStartStreamReq(CMarkup & xml, char* pP2PPucId);
	virtual void SendMsg_Ex(char * pMsg);
	virtual void ProcessExCmd();
	
	virtual void Process_ACK_Wait(char* pMsg);
	virtual bool NeedWaitTransFile(int nCurrentFrameID);
private:
	EN_MISSION_TYPE m_nSessionType;
	ST_TRANS_REQ_T m_nFwdInfo;
	char m_sAddStreamBuf[512];
	pthread_mutex_t m_nAddStreamBuf_Lock;
	int m_nWaitSendFrameID;
};

#endif

